In XmlWriterSettings, try ConformanceLevel property as below. If the writer detects any information items that would violate the specified level of conformance, it throws an exception. In some cases, the writer automatically corrects the conformance error.
XmlWriter xmlWrite;
XmlWriterSettings settings = new XmlWriterSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.OmitXmlDeclaration = true;