There are a lot of different ways someone can be denied their DEX bonus to AC, so "it depends." So the first thing you need to note is that
d20PFSRD:
The rogue's attack deals extra damage anytime her target would be denied a Dexterity bonus to AC (whether the target actually has a Dexterity bonus or not), or when the rogue flanks her target.
You do NOT need an opponent to be flat-footed in order to sneak attack them. Now, being flat-footed does deprive you of DEX bonus to AC, so it also triggers sneak attack, but
a) flat-footed does more than just that, like prevent you from making AoOs, so read the condition and
b) there's a lot more ways of being deprived of your DEX bonus short of being flat-footed (blinded, stunned, the opponent being hidden, about a dozen feats, etc).
Confusing flat-footed with denied DEX to AC will lead you astray in many cases. When a rule says one that's what it means, and while flat-footed also means deprived of DEX to AC the converse is NOT true.
Surprise Rounds
During a surprise round, an opponent is flat-footed, and does not lose the flat-footed condition until their first action. So they may be sneak-attacked with impunity by multiple attackers, or multiple times by you if you can somehow do that in the one action a surprise round gives you.
Invisibility
Unless you have improved invisibility, with normal invisibility you become visible as soon as you attack, so the target is only denied their DEX bonus to AC for the first attack. They are NOT flat-footed, so can take attacks of opportunity if they know where you are. If they know you're there from a DC20 Perception check, I'd say it's a little ambiguous RAW-wise whether they'd get an AoO from, for example, you attacking from invis with a combat maneuver that provokes (grappling them without Improved Grapple for example) - most GMs would rule not, but be advised that invis isn't perfect and has a lot of caveats in its description.
Other
There's a lot of ways to lose DEX to AC and they're all different, and whether they persist for one attack or one round or forever is all based on the specific power.
Also see