Facing an Unseen Opponent
To properly defend itself in combat, a creature must be able to see its foe, or use some ability acute enough to substitute for sight, such as the blindsight special quality (or the uncanny dodge ability; the section on uncanny dodge section is in Part Three).
When facing a totally concealed foe, a creature is denied Dexterity bonus (if any) to Armor Class and the attacker gets a +2 attack bonus as well.
Perhaps the most common form of total concealment is the invisibility spell. A regular invisibility effect is broken when you attack. If you begin your turn under such an effect and you're making multiple attacks, you'll be invisible only for the first attack and your opponent will be denied Dexterity bonus to Armor Class (if any) against that first attack.
Just about everyone has total concealment against a blinded creature, and total darkness gives everything total concealment against foes that don't have darkvision. Remember however, that concealment cuts both ways. Sneak attacks aren't possible when the target has any concealment whatsoever.
Some special qualities and skills allow creatures a limited ability to locate unseen foes. The scent special quality and the Spot and Listen skills all give some chance of figuring out exactly where an unseen foe lurks. So can cruder means, such as scattering sand or flour all over a dungeon floor when you suspect there's an invisible foe nearby. These measures allow you to locate an unseen foe, and possibly attack her, but they don't negate the foe's total concealment, so they won't keep you from being sneak attacked. It's not enough to know where your foe is. You've got to know when and where the attack is coming.
On the other hand, it's only total concealment that interferes with Dexterity bonuses to Armor Class. Anything that knocks down total concealment to a lower degree makes any Dexterity bonuses to Armor Class available again. A spell such as see invisibility or true seeing robs an invisible foe of its total concealment, but only for the creature using the spell; the spell user could then use other means to render the invisible foe at least partially visible to allies, however. Splattering an invisible foe with a little flour or paint reduces or eliminates an invisible creature's total concealment, at least for a little while, as does a trusty glitterdust or faerie fire spell.
The blindsight ability allows its user to discern any unseen creature within range just as though the unseen creature was fully visible (provided the creature with blindsight has line of effect to the concealed creature). A creature with blindsight thus retains its Dexterity bonus to Armor Class (if any) against an unseen foe and blindsight also negates most kinds of concealment. This means that you can't sneak attack a creature with blindsight unless you have it flanked or catch it flat-footed. Also, a creature with blindsight can ignore any concealment a foe has when making a sneak attack of its own.
...