I have several identical elements with different attributes that I\'m accessing with SimpleXML:
I was also strugling with this issue and the answer is way easier than those provided over here. you can just look for it using xpath and unset it it the following method:
unset($XML->xpath("NODESNAME[@id='test']")[0]->{0});
this code will look for a node named "NODESNAME" with the id attribute "test" and remove the first occurence.
remember to save the xml using $XML->saveXML(...);