5e SRD:Unseen Attackers and Targets
From D&D Wiki
|This material is published under the OGL 1.0a.
Unseen Attackers and Targets
Combatants often try to escape their foes' notice by hiding, casting the invisibility spell, or lurking in darkness.
When you attack a target that you can't see, you have disadvantage on the attack roll. This is true whether you're guessing the target's location or you're targeting a creature you can hear but not see. If the target isn't in the location you targeted, you automatically miss, but the GM typically just says that the attack missed, not whether you guessed the target's location correctly.
When a creature can't see you, you have advantage on attack rolls against it. If you are hidden–both unseen and unheard–when you make an attack, you give away your location when the attack hits or misses.