Is it possible to use a spell such as detect magic or detect
evil to detect an invisible foe?
Yes, but not very efficiently. Let's say a character uses a detect magic spell; the spell reveals nothing about the invisible foe unless the character happens to aim the spell at the area containing the invisible foe. If the foe is using an invisibility spell, a spell-like invisibility power, or a supernatural invisibility power, the detect magic spell merely reveals that there is magic somewhere in the area. The detect magic caster has no idea where the magical aura is, what sort of creature or object bears the aura, or if the aura is in motion or not...(Ed. note: continues, specifying details for succeeding rounds)