The following should work for you:
DECLARE @FileName varchar(50)
SET @FileName = 'C:\Pending invoice.txt'
EXEC master..xp_cmdshell 'bcp "select customers.customer_name,invoice.invoice_date from
customers,invoice where invoice.customer_id=customers.invoice_id and status='Pending'
" queryout "' + @FileName + '" -U ... -P ... -c'
Replace ... with the user/password combo that you need.