Nonlocal singular problem and applications to MEMS