Using WPDB to output raw XML fails because of wp-blog-header.php

Include wp-load.php, not wp-blog-header.php. Better yet, hook onto the execution of a standard WordPress request and die early.

isset( $_GET['my_conditional_check'] ) && add_action( 'plugins_loaded', 'my_xml_output' );
function my_xml_output()
{
    // do my stuff
    exit;
}

This’ll run WordPress, then my_xml_output(), then die before the request is actually parsed & the template is loaded/rendered:

http://example.com/?my_conditional_check