An assailant wearing a white mask shot a 21-year-old man to death as he sat in his car outside a Framingham apartment building Wednesday night, prosecutors said. The victim was identified as Juan Lopez of Framingham. Lopez was sitting in a car in the parking lot at 15 Second St. when he was shot just before 11 p.m., Middlesex District Attorney Marian Ryan’s office said. Natick police later recovered a white mask that may have been the one worn by Lopez’s killer, authorities said. No arrests have been made. Ryan said in a statement that investigators “do not believe this was a random attack.’’John R. Ellement can be reached at firstname.lastname@example.org. Follow him on Twitter @JREbosglobe.