How does the DM have an NPC guess where to attack me if my PC is invisible, since the DM always already knows? Unseen Attackers and Targets says:
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.
Does the DM have to pick a 5×5 square when playing on a grid? Should the DM roll the dice to choose?
A random roll for location is the best solution when an Out of Character player knows the location but has to "guess" in-game without that knowledge.
Given that, I'd like to discuss the times when there is and isn't a known location of a creature. The RAW regarding unseen attackers and hidden attackers is fairly clear, although it is also somewhat counterintuitive to reality.
Unseen and Hidden - Location on Grid is Unknown
In this case, if the creature has Hidden successfully, then their location is unknown. They are unseen and have actively worked to not be heard or create anything that would give away their location. At this point, they'd just be guessing - and to guess, they'd have to know you were there in the first place.
Determining the location when Unknown
In this case, it is up to the DM decide what location to pick if they know you're in the room, but not where. If it was a PC picking a random spot without knowledge of actual location, then that's fine.
But given that the DM knows your actual location, a random roll for potential spots is entirely reasonable and resolves the situation fairly.
Unseen, but not hidden - Location on Grid is Known
Your quote box sums up the situation very well. The key phrase in there is a target that you can't see. There are other ways to detect the location of a target (hearing, smell, disturbance of the environment, etc.) that give away it's location to you. This allows you to know the specific location, but you attack at disadvantage. You are also not able to use any spells or abilities that require sight.
Commentary: Many people are frustrated by this lack of realism regarding invisible creatures having a known location. It is entirely within the purview of the DM to make the call that there are no external clues that would give away location based on their environment (effectively automatically Hidden without having taken the action to Hide), etc. However, the strict reading is that location known, but disadvantage given.