When using ServerQuery on teamspeak, you need to make sure you have the level of access that you require the login to have.
For instance, if you want to setup a ServerQuery login with only guest access, to view channels and nothing else you need to be in that Server Group on Teamspeak when you create the login user.
To setup a ServerQuery login, you will need to login to your Teamspeak server through the Teamspeak Client.
From there, you will need to navigate to Tools > ServerQuery Login.
You will then be prompted to enter a username as below.
Once you hit ok, Teamspeak will generate a random password for that name as a login.
You can then use the Name + password to login to your Teamspeak server using the IP and query port. If required you can also specify your servers port to directly connect to it.