Hi,
A couple things.
First, you're doing an XPATH query for a "photo" node, so the photo node(s) will be returned, not their parents.
And second, you access attributes in SimpleXML by using its ArrayAccess interface.
This may not be exactly it, but it will give you a better idea of what you need to do:
$xml = simplexml_load_file("pictures.xml");
$photos = $xml->xpath("/gallery/photos/photo[@path='sunflower01.jpg']");
echo $photos[0]['thumbpath'];