The White House on Tuesday threatened to veto the first piece of legislation introduced in the Republican-controlled Senate, a bill approving the much-delayed Keystone XL oil pipeline, in what was expected to the first in many confrontations over energy and environmental policy.