No.
I mean, Steam can totally ban you if you breach their terms of use or something, sure, but getting an invalid key on g2a shouldn’t cause any problems.
If your key is invalid, it means there’s a typo or something. You won’t activate it on your account, you’ll just get an error message saying it’s a bad key.
Revoked keys, on the other hand, used to be valid, but at one point the developers decided to deactivate them for some reason.
Such a key will be removed from your library, so you’ll no longer have access to this game, but aside from that, you shouldn’t suffer any other repercussions.
I guess it would be much worse for you to trade your Steam account, for example – there is a chance it would get banned, or if you bought one and this has been discovered later on. Or if you start abusing other users by cursing them out or posting illegal stuff on Steam forums.
Coming back to the g2a case, can you get banned for buying Steam keys there? There are so many questions about the legitimacy of the products sold on this platform that have already been answered on this website, so let’s just talk about a few basic points here:
1. Sellers are legit in general, because they have been verified before selling on g2a. This deters scammers, too. Even if someone’s been lucky enough to have fooled g2a’s AML services, they will most likely get banned soon afterwards the moment someone reports anything suspicious or g2a’s security systems pick up any weird activity.
2. If you’re getting an invalid key message, then it’s probably just a typo or some stuff like that, so contact the seller and let them know there’s something wrong with the key you bought. They’ll usually be more than happy to help you out, as a satisfied customer = better ratings and more customers.
3. The fact that a key got revoked doesn’t mean a seller is shady, this stuff is often beyond their control, because game developers might choose to deactivate any amount of keys and you might get the unlucky one.
4. It’s obviously best if you choose the offer from someone labeled an Excellent Seller or something, but even if you don’t and something wrong happens, just contact the seller and they’ll send you a working key.
And if you do somehow run across a dishonest seller, report them to g2a. There’s the so-called money back guarantee on the platform, so you should be good.