Wondrous Item, legendary (requires attunement)
This beetle-shaped medallion provides three benefits while it is on your person.
Defense. You gain a +1 bonus to Armor Class.
Preservation. The scarab has 12 charges. If you fail a saving throw against a Necromancy spell or a harmful effect originating from an Undead, you can take a Reaction to expend 1 charge and turn the failed save into a successful one. The scarab crumbles into powder and is destroyed when its last charge is expended.
Spell Resistance. You have Advantage on saving throws against spells.
Notes: Bonus: Armor Class, Advantage: Saving Throws
This should prevent decapitation from, say, a Beheaded Vengeful Spirit, if used to make the save.
This is cool but really doesn't feel powerful enough to be a legendary item. Being a legendary item means it's only gonna be useful against whatever the undead BBEG is assuming you even have an undead/necromancer BBEG and possibly some of their minions at the end of a campaign. Otherwise it's just a ring of protection and a mantle of spell resistance combined.