Manual:$wgDisableAnonTalk

Details
Disable links to talk pages of anonymous users (IPs) in listings on special pages like page history, recent changes, etc.

This does not disable the talk page itself, nor does it remove the "mytalk" link anonymous visitors see on top of every page. For that, use the  hook to remove the link to the talk page of anonymous users: