A car bomb has exploded outside the former foreign ministry in the Somali capital, Mogadishu, killing five people including the suicide bomber.
The attack came as Kenya's defence and foreign ministers were holding talks nearby with the Somali government.
Kenya sent troops to Somalia on Sunday to fight Islamist al-Shabab militants it blames for a spate of kidnappings.
There have been contradictory statements from both countries about the presence of the Kenyan force.
A Somali government general, Yusuf Dhumal, told the BBC Somali Service on Tuesday from the village of Taabto, that his troops were with the Kenyan force heading towards an al-Shabab-held town of Afmadow, 120km (75 miles) from the border.
Al-Shabab, which controls much of southern Somalia, has denied carrying out any abductions and has warned of attacks in Kenya unless the troops withdraw.
Kenya's defence and foreign ministers, Yusuf Haji and Moses Wetangula, were at the city's main airport for talks with Somali government officials, when the car bomb exploded on a busy street about 2km (more than one mile) away.
The BBC's Mohamed Moalimu in Mogadishu says three civilians died at the scene and a fourth person died later at hospital. More than 10 people were wounded in the attack.
The UN-backed transitional government in Mogadishu has refused to admit that the Kenyan troops are inside Somalia.
Mr Wetangula, who on Monday had said Kenya troops were in Somalia, said the talks with Somali officials had centred on bilateral relations and the fight against al-Shabab.
But his colleague Mr Haji, in an interview in Somali at Mogadishu airport, categorically denied that Kenyan troops were in Somalia.
"The Kenyan government did not declare anything of the sort... no Kenyan troops have been deployed to Somalia," he told the BBC.
He said that Kenya had always refused to be part of the African Union force in Mogadishu in order to ensure good neighbourly relations.
The BBC's Nairobi bureau editor David Okwembah says the defence minister may have given a contradictory message as he was addressing a Somali audience.
Meanwhile, the BBC's East Africa correspondent Will Ross says as the Somali transitional government relies on foreign troops from the African Union, it is embarrassing for it to admit that it needs yet another country to intervene.
The government controls very little territory, but does have several militant groups around the country it regards as allies, and it is backed by the international community.
Previous foreign interventions in Somalia have ended in humiliating withdrawals - the US in 1992 and Ethiopia in 2006.
Correspondents say many Kenyans will fear their country could be bogged down in a long, unwinnable conflict.
Kenyan army spokesman Maj Emmannuel Chirchir has said the Kenyan army's advance is going well, despite troops' progress being slowed down by muddy terrain and heavy rain.
He said they expected to soon reach Afmadow, about 90km north of the port city of Kismayo, al-Shabab's main economic power base.
Eyewitnesses say al-Shabab officials have forced truck owners to hand over their vehicles so that fighters can be moved towards Afmadow.
Afmadow resident Hussein Osman Roble told Reuters news agency most people in the town had fled towards the Kenyan border.
"Jets have flown low over Afmadow, terrifying the residents, while al-Shabab is digging trenches and tunnels for defence inside and around Afmadow," he said.
Nairobi has been infuriated by a string of abductions of foreign nationals near the border. Most recently, two Spanish aid workers were seized from the Dadaab refugee camp.
A Frenchwoman living in Lamu and a British woman tourist have also been kidnapped in recent weeks and a British man killed.
Kenyan officials have said they want to ensure al-Shabab militants are not able to operate anywhere near the two countries' shared border.
Al-Shabab, which has links with al-Qaeda, has threatened Kenya on several occasions in the past.
But it has rarely acted outside Somalia - the only previous major attack it has said it carried out was a 2010 suicide bombing in Uganda's capital Kampala in which dozens of people died.