Go to settings, and click on Privacy settings.

1. First button is for Online visibility: If you wish to hide your online status, so you DON'T want people to know whether you are online or not, switch it ON.