The benefit of the feat Bodyguard is used after the foe's attack roll is made but before the GM reveals the attack roll's result
Combat on Combat Statistics on Attack Roll says
An attack roll represents your attempt to strike your opponent on your turn in a round. When you make an attack roll, you roll a d20 and add your attack bonus. (Other modifiers may also apply to this roll.) If your result equals or beats the target’s Armor Class, you hit and deal damage.
You, in this case, is the monster attacking your buddy. Were the monster to make the attack roll and the result revealed, everyone would suffer the consequences of the attack. It'd be already known whether or not the attack hit and deals damage, and too late to do anything about the result.
Except in rare cases, Pathfinder has no declare phase. Unlike, for example, some trading card games, a creature needn't first say that it's attacking then attack; instead, a creature just makes an attack roll. Before the monster makes the attack roll, the monster typically has a lot of other options, like making its appropriate attacks against anyone. Making the attack roll, then, is the creature declaring it's attacking its foe—by taking a poke at the dude! That is, were the benefit of the feat Bodyguard able to be used before the attack roll, it'd lock the creature into attacking that foe before the foe's locked itself into making the attack by making the attack roll!
So, typically, the only chance there is to use the benefit of the feat Bodyguard is between an already-made attack roll and the DM revealing whether or not the result means that the attack hits and deals damage.