Your question is flawed, but... it should work
If the Barbarian sees the enemy turning invisible, they know exactly where they are, regardless of how strange that might sound. Being invisible is not the same as being hidden, so despite the fact that the enemy is invisible, the Barbarian will be able to locate it exactly and attack it with disadvantage. See this answer for an extra explanation.
An invisible creature is impossible to see without the aid of magic or a special sense. For the purpose of hiding, the creature is heavily obscured. The creature's location can be detected by any noise it makes or any tracks it leaves.
However, being invisible does allow the creature to now try to hide, even if they would otherwise be in plain sight. If they succeed their stealth check, they are now not just unseen, they are also hidden.
At this point, you no longer know the location of the creature.
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 DM typically just says that the attack missed, not whether you guessed the target's location correctly.
This paragraph seems to suggest that you are still trying to attack the creature, even if you guess its location wrong, so it should count for the purposes of rage.