Your XML document uses default namespace, so you have to use it in your query too:
var ns = XNamespace.Get("http://www.sitemaps.org/schemas/sitemap/0.9");
IEnumerable<XElement> blogs = from post in sitemap.Root.Elements(ns + "url")
where ((string)post.Element(ns + "loc") ?? string.Empty).StartsWith("http://www.mysite.com/about/blog/")
select post;
I used ((string)post.Element(ns + "loc") ?? string.Empty)
to make sure no exception is being thrown when <loc>
element does not exist, but if you're sure that every <url>
has <loc>
in it you can replace that with just ((string)post.Element(ns + "loc"))
.