If you can't target the target, it doesn't matter what square it is in. It is an unnecessary question to ask.
That is a very interesting position to take. I mean, the ability to target something can be obscured in multiple ways. Say, for instance, the corner the goblin ran around was the end of an illusionary wall, and, in reality, the pcs have a clear line of effect through the illusionary wall to the goblin. Would they then get the location information, indicating that there is a clear line of effect, or would it be hidden from them because they don't yet know the wall is illusionary?
What if a player wants to know if the goblin is withing 20' of the corner because, if so, they'll launch a fireball to catch the fleeing goblin in the radius? Do they get more precise information, despite the inability to target the goblin directly, because they've engaged a AOE?
What if the player in question is a fighter without ranged weapons? Do they lose the knowledge of precise location because a target is heavily obscured and outside their reach? They have no means to target, at that point, so do they lose track of the location of the target?
So many things wrapped up in that statement of 'if you can't target the target, it doesn't matter what square it's in.'
As far as the trolls are concerned... if they aren't trying to hide, then sure. There are a couple trolls around the corner doing whatever normal stuff trolls are doing when they aren't concerned with hiding from someone. In this case, it's probably the trolls asking the goblin "What the hell is your problem, pipsqueak? Why you running?" But if the trolls were trying to keep quiet, then the DM would have rolled DEX (Stealth) checks for them.
I find this an interesting statement also. You're essentially saying that all creatures must, at any time within some detection radius of the players (more later) be either attempting to hide or engaging in very noticeable behavior. You've declared that NPCs must be acting in a noticeable manner to justify the means by which the PCs automatically notice them. That's... odd. Does this also mean that PCs are talking or moving loudly at all times they aren't hiding? Do enemies always know where the PCs are because the PCs are asking loud questions and being noticeable when not hiding?
As far as the ogre even further away is concerned... that's a DM ruling on whether they think the ogre is far enough away to be out of ear/air/smellshot. If it is, then it doesn't matter whether it's hiding or not, and what square it is or isn't in.
Ah, so there is agreement that an enemy may be unnoticed without hiding. We're now just negotiating the distance.
But let's unpack this a bit. The ogre is really smelly. The players are at the edge of the range by which they smell the ogre. You now say that they're aware of the exact location of the ogre, provided there's some line of effect that allows some kind of targeting of the ogre, yes? Or they now know of the ogre, but not where it is, provided they can't target it? And this is only based on smell, they can't see or hear it, just smell it, so smell can provide position for pcs?