Intelligence agents in the UK and US have foiled an alleged chemical bomb plot in Britain, the BBC has learnt.