Try this command:
xmllint --xpath '//thing[foo="abc"]/bar/text()' test.xml
Another command:
echo 'cat //thing[foo="abc"]/bar/text()' | xmllint --shell test.xml
Also try xmlstarlet
:
xmlstarlet sel -t -m '//thing[foo="abc"]/bar' -v 'text()' test.xml