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.
One round later, the detect magic user can search for magical
auras again. If the user aims the spell at the invisible foe again,
detect magic spell will reveal the number of magical auras on
the foe and the strength of the strongest aura. (The user has
scanned the same subject for 2 consecutive rounds.) The detect
magic user still has no idea exactly where the foe is, what the
foe is like, or whether the foe is moving.
After another round goes by, the detect magic user can scan
for magical auras once again. If the user is lucky enough to
catch the invisible foe for a third time, she will have scanned
the same subject for 3 consecutive rounds. The detect magic
spell now reveals the strength and location of each aura. The
detect magic user still does not “see” the foe and does not know
whether it’s moving or not. She only knows the strength and
locations of magical auras during her turn in the initiative
order. In this case a “location” is the 5-foot square that contains
the aura. If the creature or item bearing the aura takes up more
than one square, the detect magic user can get some idea of its
size. (See Big and Little Creatures in Combat in Chapter 8 of
the Player’s Handbook.) It is possible for the detect magic user
to attack the location of one of the auras the spell has revealed.
If the spell revealed auras in different locations, the detect
magic user still might not choose the right location to attack.
Even if she does, the foe has 100% concealment and the attack
has a 50% chance to miss no matter what the attack roll is.
Remember that all of the foregoing depends on the detect
magic spell user scanning the invisible foe for 3 consecutive
rounds. If the detect magic user guesses wrong about where to
scan even once, she’ll have to start the process of zeroing in on
the invisible foe all over again.