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] }}