Rory McIlroy has issued an apology after pulling out of the Honda Classic in Florida midway through the second round.