George O’Toole of the U.S. District Court ruled that the plaintiffs, several labor unions, lacked a “direct stake” in Trump’s directive.