A senior Iraqi army officer and seven others were killed when Islamic State militants attacked a military headquarters near Haditha.