Rory McIlroy has narrowly missed holing a shot at the BMW PGA Championship – despite the head of his golf club falling off.