You can only be flat-footed at the start of combat (usually, no don't someone will point to a poorly worded, feat or spell that makes folks flat-footed after combat has started). Once you've had your action in the round you are no longer considered flat-footed, but other events can deny you your Dexterity Bonus to AC, this does not however make you 'flat-footed'.
Uncanny Dodge only lets you keep for Dexterity Bonus to AC, when flat-footed* or struck by an invisible attacker. Thus preventing a sneak attack in those circumstances. If you are denyed your Dexterity Bonus to AC, for any other reason (such as a fient), Uncanny Dodge is of no help so you lose your Dexterity Bonus to AC.
*You are still considered Flat-footed however so you don't threaten an area and can't make AoO.