There are many ways you could achive this, but the simplest way I found is just give a proper name of the DataSet and DataTabel and use GetXML() function of DataSet
Following code snippet could help;
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("UserName",typeof(string));
dt.Columns.Add("Password", typeof(string));
DataRow dr=dt.NewRow();
dr["UserName"]="ram";
dr["Password"]="pass001";
dt.Rows.Add(dr);
dr=dt.NewRow();
dr["UserName"]="Shaym";
dr["Password"]="pass002";
dt.Rows.Add(dr);
ds.Tables.Add(dt);
ds.DataSetName="Root";
dt.TableName="A";
Output of the code is as below;
<Root>
<A>
<UserName>ram</UserName>
<Password>pass001</Password>
</A>
<A>
<UserName>Shaym</UserName>
<Password>pass002</Password>
</A>
</Root>
Hope it solves your purpose.