If you write XML using XmlWriter, you can set the encoding to the one that was initialized to exclude the specification.
EG: the constructor of System.Text.UTF8Encoding takes a boolean value to indicate whether you want a specification, therefore:
XmlWriter writer = XmlWriter.Create("foo.xml");
writer.Settings.Encoding = new System.Text.UTF8Encoding(false);
myXDocument.WriteTo(writer);
Would create an XmlWriter with UTF-8 encoding and unsigned byte order.
source
share