The Danish prime minister was “shocked” by the attack in a Copenhagen square on Friday, her office said.