Man foils robbery bid, shoots robber dead