Critical text on invisibility is found at:
When under the effect of invisibility, if an action is taken that can possibly be interpreted by the DM as an attack, it counts as an attack for ending the spell. Examples include breaking open a barrel or throwing a rock. Note that the rules specifically say that opening doors does not break invisibility.
When an offensive spell is declared, invisibility is lost at the same moment the caster becomes interruptable, AKA at the top of the round. This happens regardless of which segment actual casting begins on (AKA, this works exactly like interruptability).
The +4 from invisibility supersedes and does not stack with the +2 for a rear attack.
The +4 from invisibility does not stack with the +4 from Backstab, though an invisible and stationary thief is considered to be Hidden In Shadows (see Thief Abilities).
IMPORTANT: If an item leaves an invisible creature's person, it becomes visible. It does not become invisible again when it is picked back up. If a visible item is being held, attacks against the creature can be made at -4. If an entire clothing set or suit of armor is visible, attacks are as though the creature was not invisible at all.
Due to the above, invisibility can typically not be maintained during downtime, since the character will need to pick up and remove several items during the course of everyday life. Furthermore, going around invisible in a settlement is not possible since people will be uncomfortable, distrusting, or even hostile to an invisible creature. Everyday activities will be difficult as well. For these reasons, characters will not be invisible at the start of the next adventure.
Invisibility caused by a magic device cannot be triggered again until one full round after invisibility is broken. Put another way, if someone attacks while under the effect of a ring of invisibility, their opponents will end up getting a combat round where the wearer is visible before the wearer can use the ring again.1) This does not apply to psionic invisibility.
Any time someone goes invisible in view of enemies, enemies can still target them, but with the regular -4 to hit.2) This does not apply to psionic invisibility.
If invisibility is broken in order to fire missiles at or otherwise attack a charging target, the creature which lost invisibility is a potential target of the charging creature.3)
A creature which has come out of invisibility can be attacked on that same round, assuming that an enemy's attack comes after the creature came out of invisibility.4)