Flat-Footed: At the start of a battle, before you have had a chance to act (specifically, before your first regular turn in the initiative order), you are flat-footed. You can't use your Dexterity bonus to AC (if any) while flat-footed. Barbarians and rogues of high enough level have the uncanny dodge extraordinary ability, which means that they cannot be caught flat-footed. Characters with uncanny dodge retain their Dexterity bonus to their AC and can make attacks of opportunity before they have acted in the first round of combat. A flat-footed character can't make attacks of opportunity, unless he has the Combat Reflexes feat. (source)
It sounds like several rounds of combat passed before the elemental sank into the mud. As long as you got at least one regular turn before readying your attack action, which you very probably did, and as long as this is the same combat, you are not flat-footed. It sounds like you might be confusing flat-footed-ness with being surprised or otherwise 'unable to react to a blow'.
Sometimes you can’t use your Dexterity bonus (if you have one). If you can’t react to a blow, you can’t use your Dexterity bonus to AC. If you don’t have a Dexterity bonus, your AC does not change. (source)
It's up to your GM to decide when you can and can't 'react to a blow'. Regardless, losing your Dexterity bonus to AC is not the same as being flat-footed and does not mean you also will be unable to make attacks of opportunity.