You must state the name of a card in the Oracle, but the card doesn't need to be legal in the format of the game being played.
201.3. If an effect instructs a player to choose a card name, the player must choose the name of a card in the Oracle card reference. (See rule 108.1.) A player may not choose the name of a token unless it’s also the name of a card.
201.3a If a player is instructed to choose a card name with certain characteristics, the player must choose the name of a card whose Oracle text matches those characteristics. (See rule 108.1.)
Example: Dispossess reads, in part, “Choose an artifact card name.” The player can choose the name of any artifact card, even one that’s not legal in the format of the current game. The player can’t choose Island, even if an Island on the battlefield has been turned into artifact by some effect.
This wasn't always the case. There used to be a requirement for the card to be legal in the format of the game the player is playing. The rules were changed to remove this requirement when Guilds of Ravnica was released.
We've removed the forgettable requirement that names chosen when choosing a card name must come from the format being played. This was originally added to protect players from accidental misnamings in tournament settings (for example, "Shackles" in Modern—you meant Vedalken Shackles, not the white Aura Shackles) but tournament policy has evolved to protect players in other ways (you may recall some arguments around naming "Borborygmos" in Modern that led to this evolution) so the game rules don't need to do this anymore. The game rules are generally agnostic to the format being played, so this is a nice change.
Thanks to @murgatroid99 for pointing out the change.