I found this tip before Gabi pointed me to it, TBH :) You need this:

<img src='http://sitename.com/favicon.ico' onerror='failedIcon(this);'>

function failedIcon(source){
    source.src = "identikey/images/blank.png";
    source.onerror = "";
    return true;

There's nothing much else to add, just that you must ensure your replacement exists. (Maybe it should be inline.) And that you switch off the onerror handler to stop getting into infinite loops.