Can the targeting itself be perceived?
The rules for Readying an action (PHB 193) say (emphasis mine):
Sometimes you want to get the jump on a foe or wait for a particular circumstance before you act. To do so, you can take the Ready action on your turn, which lets you act using your reaction before the start of your next turn. First, you decide what perceivable circumstance will trigger your reaction. Then, you choose the action you will take in response to that trigger...When the trigger occurs, you [can] take your reaction right after the trigger finishes
If being targeted in and of itself is a "perceivable circumstance", then a creature with a Reaction available could respond to the targeting itself, and have its response occur "right after the trigger finishes" and before Steps 2 and 3, potentially influencing what modifiers are applied and thus whether or not it is hit. If, on the other hand, simply being targeted is not "perceivable", then the target would need to wait until the attack itself was resolved in Step 3, and any potential response would thus come after it was either hit or missed, too late to influence the result.
In terms of a rule basis for allowing a creature to perceive that it is being targeted, it is clear that several game features (see below) permit just that. Absent these abilities, however, it is a DM's call as to whether the targeting itself can be perceived (and thus, reacted to) under the general principle of "The DM describes the environment". In the OP's case, the DM might permit a reaction when the creature in question realizes that the archer is drawing on them, might say that the creature cannot distinguish between the archer aiming at them or their ally and so only allow a reaction to either of them being targeted but not the creature specifically, or might say that the archer's attack is simply 'too fast' for the creature to react to the targeting before the attack resolves.
Analyzing existing abilities reveals a pattern
Several game features (see below) already give creatures the ability to both detect that they (or others) are the targets of an attack, and then to respond to that targeting before the resolution of the attack itself. It could be that the initial ability to detect and respond to the targeting are available to any creature with a carefully-worded readied action, and that the game features only add more options for the actual responses. Or, it could be that the game features themselves add the ability to detect and respond to targeting, and that creatures without these features are restricted to responding to completed attacks.
Unfortunately, the current rules do not distinguish between these possibilities. As such, it is your call as a DM whether you want to increase the complexity of readied actions and reactions by allowing them to trigger off of the targeting step of attacks. If you do not, the simplest thing to rule is that absent a specific ability that allows them to react to targeting as a trigger, creatures do not have this ability, and even those who do can use it only as directed by the ability itself.
However, if you do wish to allow creatures to respond to being targeted, it is worthwhile to do a pattern analysis on the already existing abilities:
A creature with the Protection Fighting Style (PHB 72) may respond as a Reaction to an attack on another target before the attack hits:
When a creature you can see attacks a target other than you that is within 5 feet of you, you can use your reaction to impose disadvantage on the attack roll. You must be wielding a shield.
A goblin boss (MM 166) may use Redirect Attack as a Reaction when it is targeted, provided it can see the attacker:
When a creature the goblin can see targets it with an attack, the goblin chooses another goblin within 5 feet of it. The two goblins swap places, and the chosen goblin becomes the target instead.
A Mastermind Rogue can use their Misdirection ability (XGtE 46, and thanks to Medix2 for the find) as a Reaction when they are targeted:
When you are targeted by an attack while a creature within 5 feet of you is granting you cover against that attack, you can use your reaction to have the attack target that creature instead of you.
A creature with the Mounted Combatant Feat (PHB 168) may respond to its mount being targeted, and does not even have to use its Reaction or see the attacker to do so:
You can force an attack targeted at your mount to target you instead.
Considering all of these features, what becomes clear is that none of them cancel the attack itself or leave it without a target. ⚔ The Protection Fighting Style keeps the same target and simply applies Disadvantage during Step 2. All of the others change the target, but allow the attack itself to proceed through Steps 2 and 3 to its natural resolution.
In contrast, allowing any creature to take otherwise acceptable reactions that interrupt an attack can easily disrupt the resolution of that attack. For example, in the OP's case, allowing a creature to drop prone in response to being targeted by an attack is fine - until it drops prone behind an obstacle that gives it total cover. Since total cover should prevent it from being targeted at all, it is unclear how to proceed with Steps 2 and 3 of the attack. Similarly, if the GM allows a PC to ready a spell for casting in the event that it is targeted, what happens if the PC selects a spell such as dimension door and then moves themselves behind cover or out of range?
If you are going to permit creatures to react to being targeted, you may wish to follow the model of the already existing abilities and require that reactions do not invalidate the attack itself, but merely apply modifiers or switch the target.
⚔Medix2 Points out that the Mounted Combatant Feat, because it allows the user to switch the target to themselves, can permit someone normally untargetable (because of issues of reach or cover) to become a target and thus contradict my inferred principle that such abilities cannot leave an attack without a target. For full discussion see this question and this question, but my inclination at this point would be to rule that by using the Mounted Combatant feat, a rider is deliberately choosing to expose themself in order to protect their mount, and is thus voluntarily coming within reach or breaking cover.