The United Kingdom's highest court has ruled that the Scottish parliament does not have the power to hold a second independence referendum.