An XML file normally has a header line such as you describe - it is optional, but recommended, and XDocument always adds it when you use the Save method.
If it really disturbs you, you need to use an XmlWriter instead - it has an option to turn it off.
XDocument doc = new XDocument(new XElement("MyElement", new XAttribute("MyKey", "MyValue")));
XmlWriterSettings xws = new XmlWriterSettings();
xws.OmitXmlDeclaration = true;
StringWriter sw = new StringWriter();
using (XmlWriter xw = XmlWriter.Create(sw, xws))
{
doc.Save(xw);
}