On a serious note I've always thought that the convention of entering in potentially revealing commands into the same box that you enter in chat text was a flaw of IRC.
/msg nickserv... /query NickServ
then do the commands in the new tab. Feels slightly less wrong. :)IRC nowadays supports SASL auth, for exactly this purpose.
If you need to change passwords, use /raw NS ... or /raw NickServ ... or /quote ... or directly /NS if your client supports it. Never /msg.