BP has agreed to sell its half of a troublesome but lucrative joint venture in Russia to the state-controlled firm Rosneft for nearly $28 billion in cash and stock, the company announced on Monday. The two-step deal will leave BP with $12.3 billion in cash, a 19.75 percent stake in Rosneft, Russia’s biggest oil company, and two seats on Rosneft’s nine-person board.