Lee Kendall made a string of superb saves to give Haverfordwest hope of progressing in the Uefa Cup. The Icelandic visitors had to wait until the 74th minute to score when Allan Borgvardt struck from distance.
Kendall had earlier denied Borgvardt on three occasions as his side were forced on the back foot at Ninian Park.
Haverfordwest had their chances, but shots from Rhys Griffiths, Tim Hicks and Simon Heal all sailed narrowly past the target.
Haverfordwest had to travel 100 miles to Cardiff's Ninian Park for the match as their Bridge Meadow ground does not meet Uefa's seating criteria.
They received a boost before kick-off when captain Colin Loss was pronounced fit after a slight back problem, which softened the blow of losing player-manager Deryn Brace to an ankle injury.
Haverfordwest, playing in European competition for the first time, were the first to show in the third minute when a snapshot from Griffiths went wide.
But Hafnarfj�rdur, who are deep into their season, soon got into their stride. Atli Bjornsson tested Kendall with a powerful shot nine minutes later after Wyn Thomas had slipped.
Kendall then did well to get his body behind a well struck 25-yard free-kick from Borgvardt in the 19th minute.
The Welsh part-timers again found themselves under the cosh in the 32nd minute when Borgvardt headed wide following a cross from Gudmundur Saevarsson.
But as half-time approached, the home side began to grow in confidence in front of a small but partisan crowd in Cardiff.
Hicks almost put Haverfordwest ahead a minute after the break, rattling a shot that went narrowly wide of the target.
Kendall, however, had to be alert again minutes later when he reacted superbly to deny Jonas Gardarsson and blocked shots from Borgvardt twice in quick succession.
Then a cross from Hicks was scrambled away by the Icelanders with some difficulty before Borgvardt made the breakthrough.
Substitute Heal cracked in a shot that was deflected over the top in the closing stages.
Haverfordwest: Kendall, Barnhouse, Wayne Jones, Rossiter, Thomas, Rob Jones, Dylan Blain, Twynham, Griffiths, Loss, Hicks.
Subs: Palmer, Heal, Hudgell, Algieri, Peter Blain.
Hafnarfjordur: Larusson, Saevarsson, Sverrir Gardarsson, Nielsen, Bjarnason, Atli Vldar Bjornsson, Jonas Grani Gardarsson, Bett, Borgvardt, Gudjonsson, Hallfredsson.
Subs: Halldorsson, Stefansson, Karkov, Armann Smari Bjornsson, Asgeirsson, Einarsson, Astthorsson.
Referee: Nebojsa Rabrenovic (Serbia & Montenegro)