Unfortunately the formatter is not extensible in the way you need.
You can use an intermediate XmlDocument and modify it before writing to the final output.
This code will add a namespace to the root element of the final xml output:
var feed = new SyndicationFeed("foo", "bar", new Uri("http://www.example.com"));
var rssFeedFormatter = new Rss20FeedFormatter(feed);
// Create a new XmlDocument in order to modify the root element
var xmlDoc = new XmlDocument();
// Write the RSS formatted feed directly into the xml doc
using(var xw = xmlDoc.CreateNavigator().AppendChild() )
{
rssFeedFormatter.WriteTo(xw);
}
// modify the document as you want
xmlDoc.DocumentElement.SetAttribute("xmlns:example", "www.example.com");
// now create your writer and output to it:
var sb = new StringBuilder();
using (XmlWriter writer = XmlWriter.Create(sb))
{
xmlDoc.WriteTo(writer);
}
Console.WriteLine(sb.ToString());