A third person was seriously wounded in the incident, which was condemned by Hamid Karzai, the Afghan president, as a "despicable act of terrorism".
The two dead worked for Malteser International, a worldwide relief agency based in Germany. The injured victim worked for the United Nations Children's Fund (UNICEF). All were travelling in a UN vehicle.
The vehicle was returning from a routine mission in the Badghis province when it was attacked.
Tom Koenigs, head of the UN mission in Afghanistan, said that he would do all he could to bring those responsible to justice.
"We know of no reasons why this attack should have occurred, nor can there be reason to justify murder and maiming," he said.
Remnants of Afghanistan's former Taliban regime are often blamed for such attacks on aid workers and government officials, but most of their strikes are in the south and south-east of the country.
About 45 aid workers - both Afghans and foreigners - have died in the country since 2002, Hashim Mayar, deputy director for the Agency Co-ordinating Body for Afghan Relief, said on Saturday.