Witnesses said armed men ambushed Saado Ali Warsame's car as it was travelling in the south of the capital, killing her and her driver.
Warsame is the fourth Somali deputy to be killed since the start of the year.
Somalia's Al-Qaeda-linked Shebab threatened earlier this year to kill the country's deputies "one by one".