Attack of Opportunity
Attacks of Opportunity are additional attacks that are granted to you, when an enemy that is within your reach of melee combat is doing something that may distract them from fully defending themselves, such as drinking a potion, casting a spell, firing a ranged weapon, or moving. However, these examples apply only to untrained targets, as many feats can modify what a character can do without triggering an attack of opportunity on themselves.
Generally speaking, a character can only take one attack of opportunity per round, regardless of how many times enemies expose themselves, and in Pathfinder: Kingmaker, the system will simply take the first attack of opportunity available. This limit can be raised by acquiring the Combat Reflexes feat.
Normally, characters that are flat-footed cannot make attacks of opportunity, though like many things, this can be affected by what feats they possess.