I don't know much about preloading templates in edit boxes, but could you put an if statement in the template so it's blank if outside the main namespace? {{if|{{{NAMESPACE}}}=""|<references>||}} or something (I can't remember the syntax for if statements).
I've looked up the syntax. I think it should be:
{{#if:{{NAMESPACE}}|| [your code here] }}
That would work generally but when you're talking about preloading, whatever is in the template source code is exactly what goes in the edit box; nothing is parsed, nothing can be commented out, etc.
--Mets501