Scotland's First Minister Nicola Sturgeon has warned she would consider blocking the UK's departure from Europe if Scotland is required to give formal backing for Brexit.