That would mean to remove the Listable
attribute from Plus
. You could do it as follows, but I would not recommend that.
Unprotect[Plus];
ClearAttributes[Plus, Listable];
Plus[_?MatrixQ, __?(! MatrixQ[#] &)] := $Failed
Now, you have
a = IdentityMatrix[3];
Plus[a, a]
Plus[a, 1]
{{2, 0, 0}, {0, 2, 0}, {0, 0, 2}}
$Failed
Really, you should embrace the feature of listability rather than risking to break the whole system.
A better option might be to use the symbol CirclePlus
instead; it has no built-in meaning. (You have to restart the kernel first in order to reset Plus
to its original definition.)
CirclePlus::errorname = "Error message.";
(* This ensures that `CirclePlus` has in general the same functionality as `Plus`. *)
CirclePlus[x___] := Plus[x];
(* This this adds a special rule for undesired additions. *)
CirclePlus[a_?MatrixQ, b__?(! MatrixQ[#] &)] := (
Message[CirclePlus::errorname];
Plus[a, b]
)
Now you have
a = IdentityMatrix[3];
a⊕a
a⊕1
{{2, 0, 0}, {0, 2, 0}, {0, 0, 2}}

{{2, 1, 1}, {1, 2, 1}, {1, 1, 2}}