Well the error message you get is pretty explicit. Let us fit the model first with some data (the model comes from arima help page):
> data(lh)
> t<-1:length(lh)
arima(lh, order = c(1,0,0),xreg=t)
Series: lh
ARIMA(1,0,0) with non-zero mean
Coefficients:
ar1 intercept t
0.5221 2.0965 0.0128
s.e. 0.1208 0.2534 0.0089
sigma^2 estimated as 0.1904: log likelihood=-28.46
AIC=64.92 AICc=65.85 BIC=72.41
As you can see fitting works. This happens when we try to predict:
> predict(arima(lh, order = c(1,0,0),xreg=t))
Erreur dans predict.Arima(arima(lh, order = c(1, 0, 0), xreg = t)) :
'xreg' and 'newxreg' have different numbers of columns: 1 != 0
For forecasting you need to supply new values of your regressor, which apparently you do not. Also since you did not produce the reproducible example there might be another million reasons why the code did not work, I just picked the most likely one.