Manual:$wgDisableAnonTalk

Details
Disable links to talk pages of anonymous users (IPs) in listings in the page history, in the 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 PersonalUrls hook to remove the link to the talk page of anonymous users: