The Shield Charm might be able to block it.
Protego, the Shield Charm, can block certain types of spells. It’s never stated to block Obliviate specifically, but it’s a possible protection.
“He was still having trouble with the Shield Charm, though. This was supposed to cast a temporary, invisible wall around himself that deflected minor curses; Hermione managed to shatter it with a well-placed Jelly-Legs Jinx.”
- Harry Potter and the Goblet of Fire, Chapter 31 (The Third Task)
It blocks the Stunning Spell and Accio, so it’s possible it might block a Memory Charm as well. The cases we know of where wizards (not Muggles) had Memory Charms cast on them, the one who was Obliviated seemed to be either unaware or helpless - we don’t see anyone who knows it’s coming and tried to protect themselves.
The Weasley twins’ enchanted Shield clothing might also work.
Another form of shield that may possibly work is the Shield clothing sold at Weasleys’ Wizard Wheezes, which blocks minor to moderate hexes or jinxes, but its effectiveness against Memory Charms isn’t mentioned.
“So we’ve expanded into a range of Shield Cloaks, Shield Gloves …’
‘… I mean, they wouldn’t help much against the Unforgivable Curses, but for minor to moderate hexes or jinxes …”
- Harry Potter and the Half-Blood Prince, Chapter 6 (Draco’s Detour)
If they do work against Memory Charms, wizards could wear them as protection against having their memory wiped even if they’re not aware when Obliviate is being cast.
Memory Charms can be broken (by torture, likely other ways too).
The Memory Charm can also be broken, though it’s not clear how easy this is.
“We could have modified her memory? But Memory Charms can be broken by a powerful wizard, as I proved when I questioned her. It would be an insult to her memory not to use the information I extracted from her, Wormtail.”
- Harry Potter and the Goblet of Fire, Chapter 1 (The Riddle House)
The Dark Lord used torture, but there may be other methods as well.
“He tortured her until he broke through the Memory Charm my father had placed upon her. She told him I had escaped from Azkaban.”
- Harry Potter and the Goblet of Fire, Chapter 35 (Veritaserum)
Dumbledore was able to break through Memory Charms by using Legilimency, but it’s unclear if Morfin himself got the memory back or if Dumbledore was only able to see it himself, not restore it.
“But he had this real memory in him all the time!’
‘Yes, but it took a great deal of skilled Legilimency to coax it out of him,’ said Dumbledore, ‘and why should anybody delve further into Morfin’s mind when he had already confessed to the crime?”
- Harry Potter and the Half-Blood Prince, Chapter 17 (A Sluggish Memory)
Most of the time when Memory Charms are used, no one tries to break through it, but it seems to be at least possible. The only instance where we see it not working is on Lockhart, when he accidentally erased his own memory with Ron’s broken wand.
Many would still likely be vulnerable to sudden Obliviation.
While there do seem to be ways for wizards to protect themselves against being Obliviated, that would require them to be cautious enough to want to. Though we don’t know the extent that every wizard would be concerned about it, it’s unlikely that they’d all take precautions like wearing shield clothing. People like Mad-Eye Moody would take every precaution possible - but there are also people like Bertha Jorkins, who was a bit dim and not very careful. We don’t know how many wizards wear some sort of shield clothing (though we know the Weasley twins sold 500 with huge orders still being made). Blocking it with a spell would only work if they know it’s coming, so that’s not a certain protection. If shield clothing prevents blocks Obliviate, that’d be a wizard’s best bet - but of course it’d only work for wizards who were cautious enough to use it.