A court in London has thrown out a legal case brought by a former lover of the ex-king of Spain.