Aside from the Dragon Turtle and Purple Worm, all of them have some form of ability to negate some spells.
Planetar, CR 16, Magic Resistance
Solar, CR 23, Magic Resistance
Death Night, CR 17, Magic Resistance
Demilich, CR 18, Legendary Resistance (3/day)
Balor, CR 19, Magic Resistance...