Are you using an old version of Hpricot? When I run this code:

#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
doc = Hpricot(open("tag.txt"))
puts doc.at("#header").xpath

I get the following result:
//div[@id='header']

I'm using Hpricot 0.6 (do a gem list --local to see your version)