Yahoo! Messenger comes bundled with several ads in the main messenger window, the chat window and the webcam window.
Google Operating System Blog has provided a .bat file that removes these ads.
Make sure that Yahoo! Messenger is not running. Download the .bat file and execute it.
The batch file will edit the registry to remove the ads. If you reinstall or upgrade Yahoo! Messenger then you will need to run the batch file again.
The .bat file disables the chat room feature of Yahoo! messenger. However, for chat you can try an alternate chat client like YahELite.