An RAF aircraft carrying the Duke and Duchess of Cambridge twice tried to land in Islamabad.