This question is very similar to your previous question. You can use the same approach except a slight change in the part where we select <Query>
element to be like this :
var query = doc.Elements(ns + "DataSets")
.Elements(ns + "DataSet")
.FirstOrDefault(o => o.Attribute("Name") != null &&
o.Attribute("Name").Value == "table22")
.Element(ns + "Query");