Can you use Halicarnassus to build a duplicate card?
The base rule (p. 5) of forbidding duplicate cards is always in effect: (emphasis mine)


  Important: a player can never build two identical structures (meaning those with the same name/the same illustration).


With Halikarnassos you are still "building" a card: (p. 9)


  the first stage is worth 2 victory points and the player can look at 
  all of the cards discarded since the beginning of the game and build 
  one for free


Therefore, the base rule is still in effect: you may not build a duplicate card. If all cards are duplicates, then you cannot build anything and you have just "wasted" your special ability; this has happened once to me.