The Ring of Mind Shielding, an uncommon magic item (DMG, p. 191), has the following property (emphasis mine):
While wearing this ring, you are immune to magic that allows other creatures to read your thoughts, determine whether you are lying, know your alignment, or know your creature type.
How does this interact with effects that affect creatures of a certain alignment? After all, by common sense, something can't affect you based on your alignment if it doesn't know it.
Most notably, the Outer Planes affect "dis-aligned" creatures, as specified in the DMG. There are also some magic items that correspond to certain alignments, such as a Candle of Invocation or a Talisman of Pure Good / Ultimate Evil.
Spells such as Glyph of Warding can also affect creatures of certain alignments.
The same question rises for the matter of creature types, but I suspect the answer will be the same.