According to the Lost Encyclopedia, David was a sailor, and he wanted to sail to the Mediterranean, but he died just a month before Libby met Desmond.
After David's death, Libby went mad and committed herself to the Santa Rosa Mental Health Institute.
In an interview with Buddy.tv, the executive writers and producers confirm that this David was not Hurley's imaginary friend (or whomever inspired him):
Damon Lindelof: As to Libby's ex, that's an entirely different David [from Dave] we may or may not meet in the future.
David's death is what caused Libby to be in the mental institution.
- His full name, David Smith, was finally revealed in the Lost Encyclopedia.