Actually, strictly spoken it does.
Invisibility (emphasis mine):
The spell ends if the subject attacks any creature. For purposes of
this spell, an attack includes any spell targeting a foe or whose area
or effect includes a foe.
I don’t think I’ve ever met a DM who would rule it this way. But a DM that sticks strictly to RAW might cause message to break invisibility. Hell, pure RAW bless can break invisibility.
So yes it can, though basically no DM would rule it that way.