Assuming that your XML is contained in a variable $xml, you could use something like the following code:
$dom = new DOMDocument; // use PHP's DOMDocument class for parsing XML
$dom->loadXML($xml); // load the XML
$cars = $dom->getElementsByTagName('cars')->item(0); // store the <cars/> element
$colors = $dom->getElementsByTagName('color'); // get all the <color/> elements
foreach ($colors as $item) // loop through the color elements
if ($item->nodeValue == 'blue') { // if the element's text value is "blue"
$cars->removeChild($item->parentNode); // remove the <color/> element's parent element, i.e. the <car/> element, from the <cars/> element
}
}
echo $dom->saveXML(); // echo the processed XML