What I've done to find the faction of an NPC, is to create my own tooltip to use for scanning, do not use GameTooltip. The faction information is always below the level line, if the line after the level line is empty or contains "PvP" or "x% threat" then the unit has no faction.
With that said, there is only the problem about finding the line containing the level information:
http://www.wowinterface.com/forums/s...ad.php?t=21293