Although Sesame stores namespace declarations in the repository, there is no mechanism in place to automatically add these namespaces to a SPARQL query. It is up to you as a user to make sure the SPARQL query is correct and complete.
However, the Workbench application has an advanced SPARQL editor with autocomplete support, which automatically adds namespace declarations when you use a prefix. So you do not have to type them in manually when using Workbench. Note that this is simply a convenience of the client application, not of the actual SPARQL query engine.
Update although, as stated above, Sesame does not read namespace definitions from your Repository when parsing/executing a query, it does allow you to use prefixed names for a limited number of standard vocabularies without explicitly declaring them. These are the 'rdf', 'rdfs', 'owl', 'xsd', 'fn', and 'sesame' prefixes. If you use those in a SPARQL query without declaring them, Sesame's SPARQL engine automatically replaces them with the standard namespace to which those prefixes map (note that it does not use the namespaces in your repository for this, it uses predefined constants).
However, having said all that, it's still good practice as a writer of a SPARQL query to make sure your query is complete. Prefix declarations are an integral part of a SPARQL query, without them your query is simply not syntactically valid, and therefore not portable.