I quote from https://support.apple.com/HT201441
To remove Activation Lock from a device that isn’t in your possession, follow the steps below. If you purchased a device that's protected by Activation Lock, ask the previous owner to follow these steps.
From a web browser, sign in to iCloud.com with your Apple ID.
- Go to Find iPhone.
- Click All Devices at the top of the screen.
- Select the device that you want to remove from iCloud.
- Click Erase [device]. Select Next until the device has been erased.
- Click Remove from Account.
To start the setup process, restart the device.