Prueba con <span class="codigo"> $("#menu a[id!=lp]").each(function(){
var href = $(this).attr("href");
$(this).attr({ href: "#"});
$(this).click(function(){
$("#detalle").load(href);
});
});
</span> Revisa la documentación de jQuery, ahí está en selectors cómo hacer selecciones para excluir tags Espero te sirva.
Cristian Avila Montalvo