I can't find anything in the rule book about Flanking vs States of detection in the rulebook. I am actually wondering if you can still flank and enemy while beeing "Undetected" from a Sneak Action, but it applies to the other states of detection too.
The flanking rules state:
"To flank a foe, you and your ally must be on opposites sides or corners of the creature. A line drawn between the center of your space and the center of your ally’s space must pass through opposite sides or opposite corners of the foe’s space. Additionally, both you and the ally have to be able to act, must be wielding melee weapons or able to make an unarmed attack, can’t be under any effects that prevent you from attacking, and must have the enemy within reach. If you are wielding a reach weapon, you use your reach with that weapon for this purpose."
The parts thats making me unsure is "both you and the ally have to be able to act"
I'm thinking beeing "Hidden" would still work for flanking, since the enemy knows where squares you're in. But when beeing "undetected" is it a condition that prevent you from attacking? Only when using Sneak? Only when using a spell like invisibility?
For reference, the Sneak Action aso states: "You become observed as soon as you do anything other than Hide, Sneak, or Step."