Here’s how:
Click the circle next to your Yahoo! ID at the top of the page. This opens a pull-down menu. Click Sign out of chat.
Since Yahoo! Mail remembers your settings from session to session, you'll be signed out of chat until you change it.