{{#if: {{ns:0}} | My text for sitenotice }}
Nope: {{ns:0} always evaluates to the empty string. You'd really want
{{#if:{{NAMESPACE}}|My text for sitenotice}}. But this doesn't work either:
{{NAMESPACE}} is always evaluating to "MediaWiki"
Fortunately you can do it with CSS. Edit Mediawiki:common.css and add these two lines.
#siteNotice { display:none; } /* Hide sitenotice everywhere */
body.ns-0 #siteNotice { display:block; } /* Unhide in main namespace */
DanB