Russian and Ukrainian intelligence services have foiled an attempt to assassinate Russian Prime Minister Vladimir Putin.