You can query for that image with xpath and if there is no result, provide a default src value.
Additionally you should encode the HTML that you create:
list($src) = $img->xpath('/*/track[1]/album[1]/image[4]')?
:['http://example.com/path/to/default.png'];
printf('<img src="%s">', htmlspecialchars($src));