I observed that this yahoo messenger comes with the network's (where you are connected at) firewall restrictions. There has got to be in between with your YM and the firewall. This problem is common when you belong to a proxy.
Secondly, if the firewall is the one not bugging you, it might be the DNS servers are causing the troubles. Sometimes, it seems the connection goes well only that DNS problems got in the way. This occurs rarely but if you can catch this problem, headache solve. The second solution discusses this.
Lastly, this has also got to do with the software part, that is the YM itself. As you can read in some of the comments below, other accounts work well and to some do not. If this is the case, then the connection (firewall) itself is not the problem but the software. Yahoo's advise is to update to its recent version of YM. Well, I did this but I was trapped with the same problem. My second solution works well for this kind of problem. Read on.
Here's how I solve it:
1. Open your Internet Explorer
2. Go to Tools > Internet Options
then click the Connections
3.Click the LAN Settings button and a new dialog box will open
4. At the new dialog box, look for the Proxy server checkbox, if this is checked, uncheck it.
5. Then your done, click OK button for the dialog boxes.
6. Try logging in to your Yahoo Messenger account.
My solution is good only if you have set your proxy server previously in your Internet Explorer. I've noticed this behaviour since in our school, I need to set the proxy server to access the internet. But at home, I don't need to. So when I am at home, this is the normal situation I encounter when I forget to unset back the proxy settings.
On the other hand, the other way around should work. What I mean here is, if you connect to a network that has a proxy server, you need to setup the proxy settings in order for you to use their internet services. Thus, access to yahoo could be established.
One area to look also if the proxy is not the one causing the problem, you can check if you have your DNS Server address(es) set, which - in case you have changed your network, can't be accessible to the new network. Thus, it can cause this error.
So, you may unset the DNS Servers (Go to Network Properties >> General Tab >> TCP/IP Properties >> General Tab > Obtain DNS Server address automatically
) and try logging in your YM.
If the above solutions does not go well, this last one might be the savior. Instead of constantly banging your heads with those re-logins and reconfigurations, you can track back your YM version and replace it with an old version instead. I did this and it works for me well. I had before a version 9 Yahoo Messenger and when I replace it with a version 8, the problem was solved. This should be your last resort if the previous won't work. Remember also to be patient. If it bugs you, don't bug down... bug up!
Here's an old version of Yahoo Messenger (220.127.116.119.exe) - [Download
Hope these helps.