Can you unlock an iphone that was never activated?

I just bought an iphone (AT&T) that had never been activated. Will I be able to use this with my provider, which is not AT&T.

You can use your the service provider which you bought with that particular provider and weather it was contract or non contact also matters

No unless you unlock it. It doesn't matter if it was activated of not its not unlocked

Yes, You will be able to use this with your service provider. Just need to unlock it to use with your service provider.