SMT proximity sensor
Mouser's latest mailing mentioned this one: Vishay VCNL4000. For the price of the proximity sensor you also get an ambient light sensor. 4mm x 4mm, 0.75mm high, though it has three blobs on it which make it somewhat higher. Still looks like it's less than 3mm.  

  

Detection range for the proximity sensor is only 20cm, though.  

disclaimer: the mention of Mouser is not a shopping advice :-)