Can the Shield spell be cast in response to being hit by an invisible enemy?

Let’s say I have a PC with the shield spell. I’m not surprised, and an invisible enemy hits me with an attack. My DM has not yet told me the attack roll number, so I am in a position to cast shield if I choose to.

However, the enemy is invisible, so would I be able to cast shield in response to an attacker I can’t see? Let’s assume the attacker is permanently invisible, like they’re using the greater invisibility spell. On the one hand, the shield spell simply says:

1 Reaction*
* – which you take when you are hit by an attack or targeted by the magic missile spell

There’s no mention of needing to see the creature.

On the other hand, it seems wrong to me that I can react to an attack I can’t see coming.

Are there any rules I’ve missed that would prevent the shield spell from being cast in this scenario?