You have to remember that time is an abstract concept in D&D. Characters can react to circumstances in real time. If someone goes to search, I can take the Help action to aid them. If I have inspiration or a helpful d6 from our Bard, I can choose to use it, even for things I'm not aware of, such as a spot check to notice an ambush, or a saving throw against a spell I didn't see coming. I can use the much-maligned silvery barbs when a creature I can see succeeds at an ability check, no matter what that check is (for example, I am legally allowed to use it against a creature making a wisdom check to see our sneaking Rogue).
This should not be possible in any "sensible" interpretation of events, but because D&D time is an illusion to facilitate everyone getting a distinct turn and not making the proceedings a jumbled mess, this is exactly how the game functions.
A character casting guidance to aid another character's ability check is basically like using the Help action. It's a perk of having a Divine caster around. You can always disallow it's use, but I find it's easier (and more fun) to let the players have it.
There is, after all, the occasional use where having the Cleric utter a divine blessing might not be a good idea, such as when trying to skulk about...