How to open queries into a selected database in SQL Server Management Studio 2005
Some options that you have:


pointed already by gbn (change current connection)
click first in the databases tree and then click 'new query' or 'open file' - they will be open in the scope of the previously selected database
choose a preferred (default) database for the user (either in Security - user properties or in connection preferences)
always use USE in your queries and not rely on Management Studio :-)
add to the previous option the sqlcmd mode of Management Studio (tools - options - query execution - use sqlcmd mode) and this allows you to make use in your scripts of the :connect command which will allow you to run a specific script only in the context of a specific server