A suicide bomber attacked a Shiite mosque in Iraq’s capital city, Baghdad, killing at least 12 worshippers, security and medical officials said.