Kate Peyton, a producer based in Johannesburg, died on Wednesday while undergoing surgery at the Madina hospital in Mogadishu, a doctor there said.
"Unfortunately, the journalist [who was] shot passed away because of the injuries sustained," the doctor said.
A BBC statement issued in London confirmed that Peyton, 39, had died. BBC director-general Mark Thompson said he was "profoundly shocked and saddened" by the news, the statement added.
Medical sources said Peyton had two bullets lodged in her back but they had offered an initially optimistic prognosis for her recovery despite limited medical resources in Mogadishu.
Somalia has been wracked by 14 years of clan fighting.
Witnesses said the armed men, who sped off in a white saloon, shot her about 20m from the Sahafi (Arabic for journalist) hotel in southern Mogadishu.
No apparent reason
The vehicle was found abandoned in the Barmuda neighbourhood of central Mogadishu, Somali acting police chief Muhammad Warsame Duli said.
Since 1991 the country has been
governed by regional leaders
"Investigations have been started to arrest those cowards who killed the journalist for no apparent reason," he said.
"Since we got the vehicle used by the attackers, it will be easy for us to locate the gunmen and the owner of the vehicle."
Peyton had arrived in Mogadishu just a few hours earlier on Wednesday to join foreign reporters covering a fact-finding visit by a team of Somali lawmakers assessing conditions there for the relocation of the country's transitional government from exile in Kenya.
The BBC statement said Peyton had just arrived in Somalia with BBC correspondent Peter Greste to make a series of reports about the country.
Greste was unharmed in the incident, the BBC said.
Peyton, who was raised in Africa, had worked for the British broadcaster as a producer and reporter since 1993 and had been based in South Africa for a number of years, according to the BBC.
She had also worked as a producer and trainer for the South African Broadcasting Corporation in Johannesburg, the statement added.
"Kate was one of our most experienced and respected foreign affairs producers who had worked all over Africa and all over the world," said BBC Director of News, Helen Boaden. "She will be greatly missed, both professionally and personally."
"Those behind the killing will be punished. Local authorities are instructed to investigate the matter"
Muhammad Ali Jidi,
Somali prime minister
Somali Prime Minister Muhammad Ali Jidi described the killing as a "savage act".
"I was saddened by the killing of the innocent journalist," he said by telephone. "Those behind the killing will be punished. Local authorities are instructed to investigate the matter."
The country of about 10 million people has been a theatre of anarchic blood-letting since Muhammad Siad Barre was toppled in 1991, plunging the nation into a patchwork of fiefdoms governed by regional commanders.
Between 1993 and 1998, 10 journalists were killed in Somalia, either by mob attacks, shootings or knifings.
Nine of them were foreign correspondents slain between 1993 and 1995, when the United Nations and United States sent missions that failed to restore stability in the country owing to violent animosity with local regional leaders.