The PHB (p.205) specifies the general rule that a "clear path to the target" is required to cast a spell. The rules on cover (p.196) tell us that total cover prevents an attack or a spell.
Is there a general rule that prevents targeting by an effect that is neither a spell nor an attack?
Inspired by Does Meld Into Stone prevent Intellect Devourer attacks? but the question applies more broadly. For example, the Charm action of a Vampire (MM p.297), the Petrifying Gaze of a Medusa (p.214), the Dreadful Glare of a Mummy (p.228), some types of Spores of the Myconid (p.232) noting that the Rapport Spores expressly says it can go around corners but the others do not, the Rotting Gaze of a Nothic (p.236), and so on.
I note that there seems to be a strong theme that these are all gaze-type attacks but I think that's just that these are the most common things that fall into the category and I didn't do a full survey. The Myconid's isn't a gaze attack and I am sure there are others.