Nothing in the Opportunity Attack or Opportunity Attack Rules suggests that they exclude each other beyond the use of his or her reaction, which does not occur. is used only to launch the opportunity attack or to take the action prepared. Therefore, you can give up using the fireball prepared to launch a second-hand attack if you wish and if circumstances permit.
Using his reaction to the attack of an opportunity consumes his reaction until his next turn, so that the prepared action can not be undertaken. For prepared spells, the character will not recover the used slice of spell and may technically remain focused on the prepared spell, although they can not trigger it without an unspent reaction. Any prepared actions that have not been taken can not be more than the beginning of the character's next turn, as explained in the player's manual errata:
Ready (page 193). You have until the beginning of your next turn to use a prepared action
Therefore, in practice, a character loses his prepared action when he launches an attack by opportunity, unless he has a feature allowing him to launch an opportunity attack without using his reaction (as the Combat Fighter Tunnel Style of Underdark UA).