Protection from a color does four things, remembered by the acronym DEBT: the protected permanent or player cannot be Damaged by sources of that color, cannot be Enchanted/Equipped/Fortified by sources of that color, cannot be Blocked by creatures of that color, and cannot be Targeted by spells or abilities of that color. Each of these four protections is independent of the others (CR 702.16b).
The damage-prevention clause (the 'D' in DEBT) applies to any damage a source of the protected color would deal — whether that source targeted the protected permanent, targeted something else entirely, or didn't target anything at all. CR 702.16b states the permanent 'can't be damaged by' sources with the specified quality, with no requirement that the source have targeted it (CR 702.16b).
This means non-targeting red spells like Earthquake or Pyroclasm — which deal damage to all creatures or all players — will have their damage prevented against a creature or player with protection from red. The damage is simply prevented as a replacement effect before it can be dealt (CR 702.16b, 614.1).
Concrete example: Your opponent casts Pyroclasm (a red instant that deals 2 damage to each creature — no targeting involved). You control a White Knight, which has protection from black… but imagine it has protection from red instead. Pyroclasm's 2 damage to White Knight is prevented entirely because protection from red prevents all damage from red sources, targeted or not.
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.