Megan Fox does not appear in Transformers: Dark of the Moon (2011). Her absence stems from a very public falling out with director Michael Bay.
The film addresses Mikaela's absence in the opening scene: Sam mentions she "dumped him" via letter. No further explanation is given.
Fox and Bay later reconciled; she starred in his Teenage Mutant Ninja Turtles reboot (2014, 2016). Huntington-Whiteley received mixed reviews but returned for a cameo in The Last Knight (2017).