Can I withdraw my accepted journal paper due to data confidentiality issues? My question actually is complicated. A company provided me data for my thesis. They allowed me to use the data in my thesis. But I need get their permission if I want to publish my thesis. The thing is, my thesis can be googled at school's database. So I am not sure if this means "publish." 

I thought I do not need to get their permission since my thesis is already online and everyone can download it. Therefore, I submitted the paper (not cover everything in my thesis) to a journal and get accepted. 

Recently I found out that the company refuses to let the paper be published. So I want to withdraw my paper from the journal. 

I am the first author of the paper, and another person is the second author. I am not sure if I can decide the withdraw thing or I should let the second author know first? Also, how should I email the editor?
The basic problem here is communication. You failed to do the necessary communication up-front. Now you are going to have to do it, and do it much better than your first attempt.

Firstly, you need to talk with your coauthor and your supervisor. Expect them to be unhappy that you are only now reaching out to them, and that the proprietary nature of the data wasn't fully explained.

Secondly, you need to talk with your school's research administrators. What is their policy on externally sourced data?  Is there a common form of agreement?  Is there a term sheet listing what are acceptable and unacceptable terms?  What are the ethical expectations for dealing with commercial and with third-party data? It's very unusual for a student to negotiate directly with a company about the provision of data without some formality being required by the university. The aim being to avoid your current predicament. As a result the administrators may not be best pleased that whatever process exists wasn't followed.

Thirdly, you need to have a formal meeting with the company. Do some homework to ensure that you are speaking with the right people. Take copies of your paper -- I am assuming they have seen it, but maybe they haven't looked into it. Explore with the company what the cause of their objection to publication is. Maybe you implied a confidentiality they now feel you have betrayed, so you may need to make some deep apologies. Once you know the cause of their concern you can both explore if there are ways which meet both your wishes. It may not be possible to do all of this in one meeting. A negotiated agreement will almost certainly mean a rewrite a substantial portion of the paper.

Since you have already displayed poor communication, negotiation and business skills I strongly suggest you engage with the university and see if they can provide a senior person to do most of the heavy lifting with the company.